#import "CustomAlertViewController.h"

@implementation CustomAlertViewController
@synthesize alertView, label;
- (IBAction)doLongSomething
{
    [self.view addSubview:alertView];
    alertView.backgroundColor = [UIColor clearColor];
    alertView.center = self.view.superview.center;
    [self performSelector:@selector(updateText:) withObject:@"Getting there…" afterDelay:1.0];
    [self performSelector:@selector(updateText:) withObject:@"Really…" afterDelay:2.0];
    [self performSelector:@selector(updateText:) withObject:@"Just about there…" afterDelay:3.0];
    [self performSelector:@selector(updateText:) withObject:@"Done" afterDelay:4.5];
    [self performSelector:@selector(finalUpdate) withObject:nil afterDelay:5.0];
}
- (void)updateText:(NSString *)newText
{
    self.label.text = newText;
}
- (void)finalUpdate
{
    [self.alertView removeFromSuperview];
}
#pragma mark -
- (void)viewDidUnload {
	self.alertView = nil;
    self.label = nil;
}
- (void)dealloc {
    [alertView release], alertView = nil;
    [label release], label = nil;
    [super dealloc];
}
@end
